package com.jh.fcsm.beans.sys;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jh.fcsm.common.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.ibatis.type.JdbcType;
import tk.mybatis.mapper.annotation.ColumnType;

import javax.persistence.Column;
import javax.persistence.Table;
import java.util.Date;

/**
 * 系统用户表
 *
 * @author szx
 * @date 2020-07-05 16:25:12
 */
@Table(name = "SYS_USER")
@ApiModel(value = "com.jh.fcsm.beans.sys.SysUser", description = "系统用户表")
public class SysUser extends BaseEntity {
    /**
     *
     */
    private static final long serialVersionUID = 1L;

    @Column(name = "TYPE")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "类型")
    private String type;

    @ExcelProperty("用户类型")
    @Column(name = "TYPENAME")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "类型")
    private String typeName;

    @Column(name = "ENABLED")
    @ColumnType(jdbcType = JdbcType.INTEGER)
    @ApiModelProperty(value = "状态（1有效,0无效）")
    private Integer enabled;

    @Column(name = "SEX")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "性别")
    private String sex;

    @Column(name = "PHONE")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "电话")
    private String phone;

    @Column(name = "PHONE_COUNTRY")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "手机号区号")
    private String phoneCountry;

    @Column(name = "HEAD_IMG_URL")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "头像url")
    private String headImgUrl;

    @ExcelProperty("昵称")
    @Column(name = "NICKNAME")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "昵称")
    private String nickname;

    @ExcelProperty("用户名")
    @Column(name = "USERNAME")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "用户名")
    private String username;

    @Column(name = "PASSWORD")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "密码")
    private String password;

    @Column(name = "SALT")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "盐")
    private String salt;

    @Column(name = "LAST_LOGIN")
    @ColumnType(jdbcType = JdbcType.TIMESTAMP)
    @ApiModelProperty(value = "最后登录时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastLogin;

    @Column(name = "REMARK")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "备注信息")
    private String remark;

    @Column(name = "AREA_CODE")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "行政区划")
    private String areaCode;

    @Column(name = "AREA_NAME")
    @ColumnType(jdbcType = JdbcType.VARCHAR)
    @ApiModelProperty(value = "行政区划名称")
    private String areaName;

    /**
     * GET 类型
     *
     * @return type
     */
    public String getType() {
        return type;
    }

    /**
     * SET 类型
     *
     * @param type
     */
    public void setType(String type) {
        this.type = type == null ? null : type.trim();
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    /**
     * GET 状态（1有效,0无效）
     *
     * @return enabled
     */
    public Integer getEnabled() {
        return enabled;
    }

    /**
     * SET 状态（1有效,0无效）
     *
     * @param enabled
     */
    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
    }

    /**
     * GET 性别
     *
     * @return sex
     */
    public String getSex() {
        return sex;
    }

    /**
     * SET 性别
     *
     * @param sex
     */
    public void setSex(String sex) {
        this.sex = sex == null ? null : sex.trim();
    }

    /**
     * GET 电话
     *
     * @return phone
     */
    public String getPhone() {
        return phone;
    }

    /**
     * SET 电话
     *
     * @param phone
     */
    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }

    /**
     * GET 手机号区号
     *
     * @return phoneCountry
     */
    public String getPhoneCountry() {
        return phoneCountry;
    }

    /**
     * SET 手机号区号
     *
     * @param phoneCountry
     */
    public void setPhoneCountry(String phoneCountry) {
        this.phoneCountry = phoneCountry == null ? null : phoneCountry.trim();
    }

    /**
     * GET 头像url
     *
     * @return headImgUrl
     */
    public String getHeadImgUrl() {
        return headImgUrl;
    }

    /**
     * SET 头像url
     *
     * @param headImgUrl
     */
    public void setHeadImgUrl(String headImgUrl) {
        this.headImgUrl = headImgUrl == null ? null : headImgUrl.trim();
    }

    /**
     * GET 昵称
     *
     * @return nickname
     */
    public String getNickname() {
        return nickname;
    }

    /**
     * SET 昵称
     *
     * @param nickname
     */
    public void setNickname(String nickname) {
        this.nickname = nickname == null ? null : nickname.trim();
    }

    /**
     * GET 用户名
     *
     * @return username
     */
    public String getUsername() {
        return username;
    }

    /**
     * SET 用户名
     *
     * @param username
     */
    public void setUsername(String username) {
        this.username = username == null ? null : username.trim();
    }

    /**
     * GET 密码
     *
     * @return password
     */
    public String getPassword() {
        return password;
    }

    /**
     * SET 密码
     *
     * @param password
     */
    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    /**
     * GET 盐
     *
     * @return salt
     */
    public String getSalt() {
        return salt;
    }

    /**
     * SET 盐
     *
     * @param salt
     */
    public void setSalt(String salt) {
        this.salt = salt == null ? null : salt.trim();
    }

    /**
     * GET 最后登录时间
     *
     * @return lastLogin
     */
    public Date getLastLogin() {
        if (lastLogin != null) {
            return new Date(lastLogin.getTime());
        }
        return null;
    }

    /**
     * SET 最后登录时间
     *
     * @param lastLogin
     */
    public void setLastLogin(Date lastLogin) {
        if (lastLogin != null) {
            this.lastLogin = new Date(lastLogin.getTime());
        }
    }

    /**
     * GET 备注信息
     *
     * @return remark
     */
    public String getRemark() {
        return remark;
    }

    /**
     * SET 备注信息
     *
     * @param remark
     */
    public void setRemark(String remark) {
        this.remark = remark == null ? null : remark.trim();
    }

    public String getAreaCode() {
        return areaCode;
    }

    public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }

    public String getAreaName() {
        return areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
    }
}
